﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Brio.Framework
{
    public class IntervalRelationshipTable : Dictionary<int,double>
    {
        public IntervalRelationshipTable()
        {
        }

        public static string[] IntervalRelationshipTableNames = new string[] { "Blues", "Pop" };

        public double RelationshipMultiplier
        { get; set; }

        public void LoadRelationshipTable(string relationshipTableName)
        {
            switch (relationshipTableName)
            {
                case "Blues":
                    InitializeBluesRelationshipTable();
                    break;
                case "Pop":
                    InitializeGenericPopTable();
                    break;
            }
        }

        public void InitializeGenericPopTable()
        {
            // Set multiplier
            RelationshipMultiplier = 1.5;

            
            // Diatonic Interval
            Add(0, 50.00);   // Perfect Unison
            Add(1, 50.00);   // Minor Second
            Add(2, 120.00);   // Major Second
            Add(3, 20.00);   // Minor Third
            Add(4, 100.00);   // Major Third
            Add(5, 50.00);   // Perfect Fourth
            Add(6, 0.00);   // Diminished Fifth or Augmented Fourth
            Add(7, 30.00);   // Perfect Fifth
            Add(8, 50.00);   // Minor Sixth
            Add(9, 40.00);   // Major Sixth
            Add(10, 30.00);  // Minor Seventh
            Add(11, 0.00);  // Major Seventh
            Add(12, 10.00);  // Perfect Octave
            

            
            for (int i = 13; i < 50; i++)
            {
                Add(i, 0);
            }
        }

        public void InitializeBluesRelationshipTable()
        {
            // Set multiplier
            RelationshipMultiplier = 1.5;

                            // Diatonic Interval
            Add(0, 30.00);   // Perfect Unison
            Add(1, 50.00);   // Minor Second
            Add(2, 30.00);   // Major Second
            Add(3, 50.00);   // Minor Third
            Add(4, 10.00);   // Major Third
            Add(5, 10.00);   // Perfect Fourth
            Add(6, 40.00);   // Diminished Fifth or Augmented Fourth
            Add(7, 30.00);   // Perfect Fifth
            Add(8, 40.00);   // Minor Sixth
            Add(9, 40.00);   // Major Sixth
            Add(10, 60.00);  // Minor Seventh
            Add(11, 5.00);  // Major Seventh
            Add(12, 70.00);  // Perfect Octave


            for (int i = 13; i < 50; i++)
            {
                Add(i, 0);
            }


        }
    }
}
